<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue中Css动画原理</title>
    <script src="./js/vue.js"></script>
    <style>
        .fade-enter{
            opacity: 0;
        }
        .fade-enter-active{
            transition: opacity 3s;
        }
        .fade-leave-to{
            opacity: 0;
        }
        .fade-leave-active{
            transition: opacity 3s;
        }
    </style>
</head>
<body>
    <div id="root">
        <transition name="fade">
                <div v-if="show">hello vue and css! 渐隐渐现效果</div>
        </transition>      
        <button @click="handleBtnClick">切换</button>
    </div>
    <script>
        var vm = new Vue({
            el: "#root",
            data: {
                show: true,
            },
            methods: {
                handleBtnClick: function(){
                    this.show = !this.show;
                }
            }
        });
    </script>
</body>
</html>